﻿{include file="common/header1" /}
<div class="user w1200">
    <p class="title">Personal center</p>
    <div class="user_con flex">
        <div class="user_nav">
            <a href="/member">Personal information</a>
            <a href="/index/Member/orders" class="active">Order list</a>
            <a href="/index/Member/address">My address</a>
            <a href="javascript:;" id="logOut">Log Out</a>
        </div>
        <div class="user_right">
            <div class="user_right_box">
                <ul class="user_order_items flex">

                    <li {if $active eq 0}class="current"{/if}><a href="{:url('Member/orders')}">ALL</a></li>
                    <li {if $active eq 2}class="current"{/if}><a href="{:url('Member/orders')}?status=2">UNPAID</a></li>
                    <!--            <a {if $active eq 3}class="podios_soi"{/if} href="{:url('Member/orders')}?status=3">未发货</a>-->
                    <li {if $active eq 4}class="current"{/if}><a href="{:url('Member/orders')}?status=4">NOT RECEIVING</a></li>
                    <li {if $active eq 5}class="current"{/if}><a href="{:url('Member/orders')}?status=5">COMPLETED</a></li>

                </ul>
                <div class="user_order_list all" style="display: block;">
                    <ul>
                        {foreach name="$order" item="order"}
                        <li class="flex">
                            {foreach name="order.goodsList" item="goods"}
                            <div class="imgbox flex">
                                <span><img src="{$goods.goods_logo}"></span>
                                <div>
                                    <p class="p1">{$goods.goods_title}</p>
                                    <p class="p2">Accessory:One Size</p>
                                    <p class="p3">
                                        Colour:<span style="background: #d2bb9b;" class="colour"></span>
                                    </p>
                                </div>
                            </div>
                            <div class="user_order_money">
                                <span class="span1">${$goods.goods_total}</span>
                                {eq name='order.status' value='0'}<span class="span2 unpaid_span"><b>Canceled</b></span>{/eq}
                                {eq name='order.status' value='1'}<span class="span2 unpaid_span">Advance</span>{/eq}
                                {eq name='order.status' value='2'}<span class="span2 unpaid_span">UNPAID</span>{/eq}
                                {eq name='order.status' value='3'}<span class="span2 unpaid_span">Shipping</span>{/eq}
                                {eq name='order.status' value='4'}<span class="span2 notreceiving_span">Shipped</span>{/eq}
                                {eq name='order.status' value='5'}<span class="span2 completed_span">COMPLETED</span>{/eq}
                                <span class="span2 unpaid_span">UNPAID</span>
                                <span class="span3">{$goods.create_at}</span>
                            </div>
                            {/foreach}
                        </li>
                        {/foreach}
                        {empty name='order'}<li><div class="per_title"><h3>There are currently no related orders available</h3></div></li>{/empty}
                    </ul>
                </div>


            </div>
        </div>
    </div>
</div>


<!-- 中间区域结束 -->

<script type="text/javascript">
    //取消订单
    $(".qxfk").click(function(){
        var id = $(this).data("id");
        if(confirm("确定取消该订单?")){
            //点击确定后操作
            var url = "{:url('Member/cancel_order')}";
            $.ajax({
                type: "post",
                url: url,
                dataType: "json",
                data: { order_id: id },
                success: function (r) {
                        if (r.code > 0) {
                            //弹窗提示
                            layer.msg(r.info, { icon: 6 });
                            //跳转页面
                            window.location.href = r.data;
                        }
                        else {
                            layer.msg(r.info, { icon: 5 });
                        }
                }
            });
        }
    })

    //支付
    $(".ljzf").click(function(){

        var id = $(this).data("id");
        var pay_id = $(this).data("pay");
        var goods = $(this).data("goods");

        var url = "/index/Member/pay?id="+id+"&pay_id="+pay_id+"&goods="+goods;

        //跳转页面
        window.location.href = url;

    })

</script>
{include file="common/footer" /}